package com.santu.edu.supporter.biz.category.service.impl;

import com.santu.edu.supporter.biz.category.dao.GoodCategoryDao;
import com.santu.edu.supporter.biz.category.pojo.dto.GoodCategoryDTO;
import com.santu.edu.supporter.biz.category.pojo.params.GoodCategoryAddParam;
import com.santu.edu.supporter.biz.category.pojo.params.GoodCategoryUpdateParam;
import com.santu.edu.supporter.biz.category.service.GoodCategoryService;
import com.santu.edu.supporter.biz.user.pojo.dto.UserAddressDTO;
import com.santu.edu.supporter.util.UuidUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author luoyaoqi
 * @createTime 2024/3/12
 * @description
 */
@Service
@RequiredArgsConstructor
public class GoodCategoryServiceImpl implements GoodCategoryService {

    private final GoodCategoryDao goodCategoryDao;

    @Override
    public Boolean addGoodCategory(GoodCategoryAddParam addParam) {
        String categoryId = UuidUtils.getUuid(8);
        GoodCategoryDTO dto = GoodCategoryDTO.createItem(categoryId,addParam);
        goodCategoryDao.addGoodCategory(dto);
        return true;
    }

    @Override
    public Boolean updateGoodCategory(GoodCategoryUpdateParam updateParam) {
        GoodCategoryDTO dto = GoodCategoryDTO.createItem(updateParam);
        goodCategoryDao.updateGoodCategory(dto);
        return true;
    }

    @Override
    public Boolean removeGoodCategory(String categoryId) {
        goodCategoryDao.removeGoodCategory(categoryId);
        return true;
    }

    @Override
    public List<GoodCategoryDTO> getGoodCategoryList() {
        return goodCategoryDao.getGoodCategoryList();
    }
}
